﻿<sap:ActivityDesigner x:Class="Vision.Core.ActivityComponents.Assembly.AssemblyServiceContextDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
    Collapsible="True" ExpandState="True">
    <sap:ActivityDesigner.Resources>
        <sapc:ArgumentToExpressionConverter x:Key="argumentToExpressionConverter" />
        
        <DataTemplate x:Key="ExpandedActivityDesignerTemplate">
            <StackPanel>
<!-- Inputs Header -->
                <TextBlock Text="Input(s):" FontWeight="Bold" Foreground="Navy" Margin="0,0,0,3" />

                <Grid Margin="0,5,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <!-- ModelItem.AssemblyFilePath -->
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="File path:" VerticalAlignment="Top" />
                    <sapv:ExpressionTextBox Grid.Row="1" Grid.Column="1" x:Uid="filePathBox" x:Name="filePathBox"
                        MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                        Expression="{Binding Path=ModelItem.AssemblyFilePath, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                        ExpressionType="{Binding Path=ModelItem.AssemblyFilePath.ArgumentType}"
                        OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                </Grid>

                <Grid Margin="0,5,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>

                    <!-- ModelItem.AssemblyFileName -->
                    <TextBlock Grid.Row="1" Grid.Column="0" Text="File name:" VerticalAlignment="Top" />
                    <sapv:ExpressionTextBox Grid.Row="1" Grid.Column="1" x:Uid="fileNameBox" x:Name="fileNameBox"
                        MaxLines="1" Margin="7,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"
                        Expression="{Binding Path=ModelItem.AssemblyFileName, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"
                        ExpressionType="{Binding Path=ModelItem.AssemblyFileName.ArgumentType}"
                        OwnerActivity="{Binding Path=ModelItem, Mode=OneWay}" />
                </Grid>

                <Border BorderThickness="0,0,0,3" Margin="0,5">
                    <Border.BorderBrush>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="DarkGray" Offset="0" />
                            <GradientStop Color="White" Offset="1" />
                        </LinearGradientBrush>
                    </Border.BorderBrush>
                </Border>
                
                <!-- Body -->
                <sap:WorkflowItemPresenter x:Uid="sad:WorkflowItemPresenter_1" AutomationProperties.AutomationId="Activity" IsDefaultContainer="True" HintText="Drop activity here" Item="{Binding Path=ModelItem.Body, Mode=TwoWay}" AllowedItemType="{x:Type sa:Activity}" MinWidth="100" MinHeight="100" Margin="0,7,0,0"/>

            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="CollapsedActivityDesignerTemplate">
            <Label Padding="0,0,0,0" FontStyle="Italic" Foreground="{x:Static SystemColors.GrayTextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">Double-click to view</Label>
        </DataTemplate>
        <Style x:Uid="Style_1" x:Key="DesignerStyle" TargetType="{x:Type ContentPresenter}">
            <Setter x:Uid="Setter_1" Property="ContentTemplate" Value="{DynamicResource ExpandedActivityDesignerTemplate}" />
            <Style.Triggers>
                <DataTrigger x:Uid="DataTrigger_1" Binding="{Binding Path=ShowExpanded}" Value="false">
                    <Setter x:Uid="Setter_2" Property="ContentTemplate" Value="{DynamicResource CollapsedActivityDesignerTemplate}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </sap:ActivityDesigner.Resources>

    <ContentPresenter x:Uid="ContentPresenter_1" x:Name="ContentPresenter_1" Style="{DynamicResource DesignerStyle}" Content="{Binding}" />
</sap:ActivityDesigner>
